from Data import Data
from MetaData import MetaData,MetaDataFactory
import activist.Time

class Category(Data):
    def __init__(self,expectedid=None):
        super(Category,self).__init__(expectedid)
        self.command("create")

    command_create_VERSION = 0
    def command_create(self,title):
        self._createcalled = True
        self._title = title

    def title(self):
        return self._title

    def getXML(self):
        return """
<category class="activist.Category" id="%(id)s">
  <title>%(title)s</title>
%(meta)s
</category>
        """ % { "id":self.id(),
                "title":self.title(),
                "meta":self.getMetaXML()
                }

    def __str__(self):
        return '<Category %s>' % self.id()
